package com.cinema.service.impl;

import com.cinema.dao.SeatDao;
import com.cinema.entity.Seat;
import com.cinema.service.SeatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class SeatServiceImpl implements SeatService {
    @Autowired
    private SeatDao seatDao;
    @Override
    public int insertSeat(Seat seat) {
        return seatDao.insertSeat(seat);
    }

    @Override
    public Seat queryBySeatId(Integer seatId) {
        return null;
    }

    @Override
    public int updateBySeatId(Seat seat) {
        return 0;
    }

    @Override
    public int boolSeat(int hallId, int number) {
        int effectedNUm = seatDao.boolSeat(hallId,number);
        if (effectedNUm > 0){
            return 1;
        }
        return -1;
    }

    @Override
    public int querySeatId(int hallId, int seatSerialNumber) {
        return seatDao.querySeatId(hallId,seatSerialNumber);
    }
}
